home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK2.toast / Development Kits (Disc 2) / QuickDraw GX / Programming Stuff / Sample Code / Printing Samples / Printer Drivers… / CustomWriterGX / GlobalData.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-20  |  2.6 KB  |  86 lines  |  [TEXT/MPS ]

  1. /*
  2.     FILENAME
  3.         GlobalData.h
  4.  
  5.     DESCRIPTION
  6.         Contains code that shows a prefered way to manage unique global
  7.         data for different message handler instances.  This method
  8.         stores all globals off of the message manager instance context.
  9.         It has the advantage that it will work under any compiler.
  10.         This method is documented in detail in "Inside Macintosh: GX
  11.         Environment & Utilities" starting on page 6-10
  12.         
  13.     COPYRIGHT
  14.         Copyright © 1995 Apple Computer, Inc.
  15.         All rights reserved.
  16.     
  17.     Modification history
  18.         10/04/95 - David Hayward -    Version 1.0.4 modified code so that
  19.                                     the driver can be build under MPW,
  20.                                     Metrowerks, and Symantec.  In general,
  21.                                     all that was required to do this was 
  22.                                     to add an inline-assembly jumptable
  23.                                     and to store all globals off of the
  24.                                     message manager instance context.
  25.                                     Also made a few changes so that the
  26.                                     driver can be rebuilt to support any
  27.                                     resolution by changing the #defines
  28.                                     kResolution and kPatStretch in
  29.                                     "CommonDefines.h"
  30.  
  31.         10/03/95 - David Hayward -    Begat.
  32. */
  33.  
  34.  
  35. #include <Types.h>
  36. #include <Files.h>
  37. #include <QuickDraw.h>
  38. #include <GXPrinterDrivers.h>
  39. #include <GXPrinting.h>
  40.  
  41.  
  42. // Our buffer description
  43.  
  44. typedef struct
  45. {
  46.     Boolean                bufferIsDirty;                // Is this buffer dirty (is there data to be written out)?
  47.     char                padByte;
  48.     long                curOffset;                    // where's the next byte go in this buffer?
  49.     gxPrintingBuffer    **printBuffer;                // The buffers themselves.
  50. } BufferEntry, *BufferEntryPtr, **BufferEntryHdl;
  51.  
  52.  
  53. // our buffer group description-- a collection of BufferEntry records plus info.
  54.  
  55. typedef struct
  56. {
  57.     short        numBuffers;                // number of buffers
  58.     long        bufferSize;                // and their sizes.
  59.     short        curBuff;                // current buffer we're writing to.
  60.     BufferEntry    buff[1];                // individual buffer records.
  61. } BufferGroup, *BufferGroupPtr, **BufferGroupHdl;
  62.  
  63.  
  64. // Our global data structure
  65.  
  66. typedef struct
  67. {
  68.     long            temp;                    // accumulated lines feeds
  69.     long            lineFeeds;                // accumulated lines feeds
  70.     long            pagesImaged;            // Number of pages imaged.
  71.     long            lastYPos;                // Used by our RasterDatIn override.
  72.     short            curFileRefNum;            // refNum of current open file.
  73.     short            pixMapRowBytes;            // rowBytes of the pixmap we create.
  74.     Rect            pixMapBounds;            // Bounds of the pixmap we create.
  75.     Fixed            hRes;                    // Horizontal output resolution.
  76.     Fixed            vRes;                    // Vertical output resolution.
  77.     FSSpec            fileLocation;            // Where to put our files.
  78.     BufferGroupHdl    buffer;                    // all the buffer info
  79. } DriverGlobals, *DriverGlobalsPtr, **DriverGlobalsHdl;
  80.  
  81.  
  82.  
  83. DriverGlobalsHdl    GetGlobals        ( void ) ;
  84. OSErr                CreateGlobals    ( void ) ;
  85. void                DisposeGlobals    ( void ) ;
  86.